<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="vb,">










<meta name="description" content="使用 API 介绍这里的代码提供的是使用 vb 修改游戏的内存数据，供大家参考代码主要使用了  窗体查找函数（FindWindow） 进程获取函数 （GetWindowThreadProcessId） 进程打开函数 （OpenProcess） 读取进程内存 （ReadProcessMemory） 写进程内存 （WriteProcessMemory）  代码 demo1234567891011121">
<meta name="keywords" content="vb">
<meta property="og:type" content="article">
<meta property="og:title" content="使用VB修改游戏内存参数（完美世界）">
<meta property="og:url" content="http://www.soshare.cn/2011/04/06/110406-wanmei-vbwg/index.html">
<meta property="og:site_name" content="soshare">
<meta property="og:description" content="使用 API 介绍这里的代码提供的是使用 vb 修改游戏的内存数据，供大家参考代码主要使用了  窗体查找函数（FindWindow） 进程获取函数 （GetWindowThreadProcessId） 进程打开函数 （OpenProcess） 读取进程内存 （ReadProcessMemory） 写进程内存 （WriteProcessMemory）  代码 demo1234567891011121">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2019-10-13T06:12:12.022Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用VB修改游戏内存参数（完美世界）">
<meta name="twitter:description" content="使用 API 介绍这里的代码提供的是使用 vb 修改游戏的内存数据，供大家参考代码主要使用了  窗体查找函数（FindWindow） 进程获取函数 （GetWindowThreadProcessId） 进程打开函数 （OpenProcess） 读取进程内存 （ReadProcessMemory） 写进程内存 （WriteProcessMemory）  代码 demo1234567891011121">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"right","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://www.soshare.cn/2011/04/06/110406-wanmei-vbwg/">



<script data-ad-client="ca-pub-3578624407535320" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>


  <title>使用VB修改游戏内存参数（完美世界） | soshare</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">soshare</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">分享</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-file">
          <a href="http://taosha126.ys168.com" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-file"></i> <br>
            
            File
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>
            
            Commonweal 404
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            Search
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="Searching..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>


 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://www.soshare.cn/2011/04/06/110406-wanmei-vbwg/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="tosobright">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="soshare">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">使用VB修改游戏内存参数（完美世界）</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2011-04-06T00:00:00+08:00">
                2011-04-06
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Program/" itemprop="url" rel="index">
                    <span itemprop="name">Program</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2011/04/06/110406-wanmei-vbwg/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2011/04/06/110406-wanmei-vbwg/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2011/04/06/110406-wanmei-vbwg/" class="leancloud_visitors" data-flag-title="使用VB修改游戏内存参数（完美世界）">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">Visitors&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="使用-API-介绍"><a href="#使用-API-介绍" class="headerlink" title="使用 API 介绍"></a>使用 API 介绍</h1><p>这里的代码提供的是使用 vb 修改游戏的内存数据，供大家参考<br>代码主要使用了</p>
<ul>
<li>窗体查找函数（FindWindow）</li>
<li>进程获取函数 （GetWindowThreadProcessId）</li>
<li>进程打开函数 （OpenProcess）</li>
<li>读取进程内存 （ReadProcessMemory）</li>
<li>写进程内存 （WriteProcessMemory）</li>
</ul>
<h1 id="代码-demo"><a href="#代码-demo" class="headerlink" title="代码 demo"></a>代码 demo</h1><figure class="highlight vb"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">'--------------------------------定义------------------------------------------------------------</span></span><br><span class="line"><span class="keyword">Dim</span> hwd <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">' 储存 FindWindow 函数返回的句柄</span></span><br><span class="line"><span class="keyword">Dim</span> pid <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"><span class="keyword">Dim</span> hProcess <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存放进程句柄</span></span><br><span class="line"><span class="keyword">Dim</span> base <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存放人物基地址</span></span><br><span class="line"><span class="keyword">Dim</span> name_temp <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"><span class="keyword">Dim</span> mz(<span class="number">31</span>) <span class="keyword">As</span> <span class="built_in">Byte</span> <span class="comment">'名字</span></span><br><span class="line"><span class="keyword">Dim</span> hp <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存储生命值</span></span><br><span class="line"><span class="keyword">Dim</span> hpmax <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存储生命最大值</span></span><br><span class="line"><span class="keyword">Dim</span> mp <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存储真气值</span></span><br><span class="line"><span class="keyword">Dim</span> mpmax <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'存储真气最大值</span></span><br><span class="line"><span class="keyword">Dim</span> dengji <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'等级</span></span><br><span class="line"><span class="keyword">Dim</span> xiuzhen <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'修真</span></span><br><span class="line"><span class="keyword">Dim</span> money <span class="keyword">As</span> <span class="built_in">Long</span> <span class="comment">'金钱</span></span><br><span class="line"><span class="keyword">Dim</span> exp <span class="keyword">As</span> <span class="built_in">Double</span> <span class="comment">'经验</span></span><br><span class="line"><span class="keyword">Dim</span> yuanshen <span class="keyword">As</span> <span class="built_in">Double</span> <span class="comment">'元神</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'-------------------------配置--------------------------------</span></span><br><span class="line"><span class="keyword">Dim</span> ft <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, ft1 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, ft2 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span></span><br><span class="line"><span class="keyword">Dim</span> yc <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, yc1 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, yc2 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span></span><br><span class="line"><span class="keyword">Dim</span> cq <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, cq1 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, cq2 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span></span><br><span class="line"><span class="keyword">Dim</span> sy <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, sy1 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span>, sy2 <span class="keyword">As</span> <span class="built_in">String</span> _ <span class="number">255</span></span><br><span class="line"><span class="keyword">Dim</span> zft <span class="keyword">As</span> <span class="built_in">Long</span>, zft1 <span class="keyword">As</span> <span class="built_in">Long</span>, zft2 <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"><span class="keyword">Dim</span> zyc <span class="keyword">As</span> <span class="built_in">Long</span>, zyc1 <span class="keyword">As</span> <span class="built_in">Long</span>, zyc2 <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"><span class="keyword">Dim</span> zcq <span class="keyword">As</span> <span class="built_in">Long</span>, zcq1 <span class="keyword">As</span> <span class="built_in">Long</span>, zcq2 <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"><span class="keyword">Dim</span> zsy <span class="keyword">As</span> <span class="built_in">Long</span>, zsy1 <span class="keyword">As</span> <span class="built_in">Long</span>, zsy2 <span class="keyword">As</span> <span class="built_in">Long</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'--------------------窗口代码------------------------------------------------------------------------------</span></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Timer1_Timer()</span><br><span class="line">hwd = FindWindow(<span class="string">"ElementClient Window"</span>, <span class="string">"Element Client"</span>) <span class="comment">'获取窗口</span></span><br><span class="line">GetWindowThreadProcessId hwd, pid <span class="comment">'获取进程</span></span><br><span class="line">hProcess = OpenProcess(PROCESS_ALL_ACCESS, <span class="literal">False</span>, pid)</span><br><span class="line"></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> &amp;H92764C, base, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H20, base, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'一级基址</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H5CC, name_temp, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'得到角色名</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> name_temp, mz(<span class="number">0</span>), <span class="number">32</span>, <span class="number">0</span>&amp;</span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H450, hp, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'得到生命值</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H478, hpmax, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'得到生命最大值</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H454, mp, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'得到真气值</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H47C, mpmax, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'得到真气最大值</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H448, dengji, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'等级</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H270, xiuzhen, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'修真</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H2D4, money, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'金钱</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H458, exp, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'经验</span></span><br><span class="line">ReadProcessMemory hProcess, <span class="keyword">ByVal</span> base + &amp;H464, yuanshen, <span class="number">4</span>, <span class="number">0</span>&amp; <span class="comment">'元神</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">If</span> hwd = <span class="number">0</span> <span class="keyword">Then</span></span><br><span class="line">Label15.Caption = <span class="string">"游戏未启动"</span></span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">Label15.Caption = <span class="string">"游戏启动成功"</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Form_Unload(Cancel <span class="keyword">As</span> <span class="built_in">Integer</span>) <span class="comment">'退出 恢复</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4555473</span>, <span class="number">-2033774220</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4329880</span>, <span class="number">1155093371</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4215305</span>, <span class="number">232311257</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4216567</span>, <span class="number">1317602165</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4593432</span>, <span class="number">-125600140</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"></span><br><span class="line">CloseHandle hProcess</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'---------------启动代码------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command1_Click() <span class="comment">'OPEN</span></span><br><span class="line">CommonDialog1.ShowOpen</span><br><span class="line">Text1.<span class="keyword">Text</span> = CommonDialog1.FileName</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command2_Click()</span><br><span class="line"><span class="keyword">If</span> InStr(<span class="number">1</span>, Text1.<span class="keyword">Text</span>, <span class="string">"elementclient"</span>) &lt;&gt; <span class="number">0</span> <span class="keyword">Then</span> <span class="comment">'目录比较</span></span><br><span class="line">RPath = CommonDialog1.FileName</span><br><span class="line">Shell RPath &amp; <span class="string">" game:cpw"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">MsgBox <span class="string">"请选择路径！"</span>, vbInformation <span class="comment">'错误后，窗口信息弹出</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command3_Click() <span class="comment">'SET</span></span><br><span class="line">Shell <span class="string">"notepad.exe set.ini"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command4_Click() <span class="comment">'HELP</span></span><br><span class="line">Shell <span class="string">"notepad.exe help.ini"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check1_Click() <span class="comment">'隐藏游戏窗口</span></span><br><span class="line"><span class="keyword">If</span> Check1.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">i = ShowWindow(hwd, SW_HIDE)</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">i = ShowWindow(hwd, SW_SHOW)</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check2_Click() <span class="comment">'隐藏辅助窗口</span></span><br><span class="line"><span class="keyword">If</span> Check2.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">cSysTray1.InTray = <span class="literal">True</span> <span class="comment">'隐藏到任务栏</span></span><br><span class="line"><span class="keyword">Me</span>.Visible = <span class="literal">False</span> <span class="comment">'让程序界面不可见</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> CsysTray1_MouseDown(Button <span class="keyword">As</span> <span class="built_in">Integer</span>, Id <span class="keyword">As</span> <span class="built_in">Long</span>)</span><br><span class="line"><span class="keyword">Me</span>.WindowState = <span class="number">0</span> <span class="comment">'程序回复到 Normal 状态</span></span><br><span class="line"><span class="keyword">Me</span>.Visible = <span class="literal">True</span> <span class="comment">'从任务栏中清除图标</span></span><br><span class="line">cSysTray1.InTray = <span class="literal">False</span> <span class="comment">'令程序界面可见</span></span><br><span class="line">Check2.Value = <span class="number">0</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Timer2_Timer()</span><br><span class="line">Label14.Caption = StrConv(mz, vbFromUnicode)</span><br><span class="line">Label2.Caption = hp &amp; <span class="string">"/"</span> &amp; hpmax</span><br><span class="line">Label4.Caption = mp &amp; <span class="string">"/"</span> &amp; mpmax</span><br><span class="line">Label6.Caption = yuanshen</span><br><span class="line">Label10.Caption = dengji</span><br><span class="line">Label11.Caption = money</span><br><span class="line">Label20.Caption = exp</span><br><span class="line">Label21.Caption = xiuzhen</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'--------------工具代码------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span>'多开----------------------------</span></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command5_Click()</span><br><span class="line">TimesNow = Now()</span><br><span class="line">SetWindowText hwd, <span class="string">"YY 完美"</span> &amp; TimesNow</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span>'自动加点------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span>彩色发言-------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment"><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span><span class="doctag">'''</span>自动喊世界------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'------------------挂机代码------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Command6_Click()</span><br><span class="line">Form2.Show</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'------------------技能代码------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'------------------BT 代码--------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check3_Click() <span class="comment">'飞天</span></span><br><span class="line"><span class="keyword">If</span> Check3.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4555473</span>, <span class="number">-2033774217</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4555473</span>, <span class="number">-2033774220</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check4_Click() <span class="comment">'穿墙</span></span><br><span class="line"><span class="keyword">If</span> Check4.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4215305</span>, <span class="number">232311258</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4215305</span>, <span class="number">232311257</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check5_Click() <span class="comment">'隐藏</span></span><br><span class="line"><span class="keyword">If</span> Check5.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4329880</span>, <span class="number">1155093483</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4329880</span>, <span class="number">1155093371</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check6_Click() <span class="comment">'无限视野</span></span><br><span class="line"><span class="keyword">If</span> Check6.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4216567</span>, <span class="number">1317602166</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4216567</span>, <span class="number">1317602165</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check7_Click() <span class="comment">'空中漫步</span></span><br><span class="line"><span class="keyword">If</span> Check7.Value = <span class="number">1</span> <span class="keyword">Then</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4593432</span>, <span class="number">-125600137</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">Else</span></span><br><span class="line">WriteProcessMemory hProcess, <span class="keyword">ByVal</span> <span class="number">4593432</span>, <span class="number">-125600140</span>, <span class="number">4</span>, <span class="number">0</span>&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Check8_Click() <span class="comment">'无限跳跃</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> check9_click() <span class="comment">'小号入仙魔</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'-------------------关于代码------------------------------------------------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Label16_Click()</span><br><span class="line">url = <span class="string">"http://taosha126.ys168.com/"</span></span><br><span class="line">Shell <span class="string">"explorer "</span> &amp; url, <span class="number">0</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> Label16_MouseMove(Button <span class="keyword">As</span> <span class="built_in">Integer</span>, Shift <span class="keyword">As</span> <span class="built_in">Integer</span>, X <span class="keyword">As</span> <span class="built_in">Single</span>, Y <span class="keyword">As</span> <span class="built_in">Single</span>)</span><br><span class="line">Label16.ForeColor = &amp;H0&amp;</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="comment">'-------------------菜单代码------------------------------------------------------------------------------</span></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> 使用说明\_Click()</span><br><span class="line">Shell <span class="string">"notepad.exe help.ini"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> 退出\_Click()</span><br><span class="line">Unload Form1</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> 打开\_Click()</span><br><span class="line">CommonDialog1.ShowOpen</span><br><span class="line">Text1.<span class="keyword">Text</span> = CommonDialog1.FileName</span><br><span class="line"><span class="keyword">If</span> InStr(<span class="number">1</span>, Text1.<span class="keyword">Text</span>, <span class="string">"elementclient"</span>) &lt;&gt; <span class="number">0</span> <span class="keyword">Then</span> <span class="comment">'目录比较</span></span><br><span class="line">RPath = CommonDialog1.FileName</span><br><span class="line">Shell RPath &amp; <span class="string">" game:cpw"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">If</span></span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> 关于\_Click()</span><br><span class="line">frmAbout.Show</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">Private</span> <span class="keyword">Sub</span> 配置\_Click()</span><br><span class="line">Shell <span class="string">"notepad.exe set.ini"</span>, vbNormalFocus</span><br><span class="line"><span class="keyword">End</span> <span class="keyword">Sub</span></span><br></pre></td></tr></table></figure>


      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wx.jpg" alt="tosobright WeChat Pay">
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/ali.jpg" alt="tosobright Alipay">
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>Post author:</strong>
    tosobright
  </li>
  <li class="post-copyright-link">
    <strong>Post link:</strong>
    <a href="http://www.soshare.cn/2011/04/06/110406-wanmei-vbwg/" title="使用VB修改游戏内存参数（完美世界）">http://www.soshare.cn/2011/04/06/110406-wanmei-vbwg/</a>
  </li>
  <li class="post-copyright-license">
    <strong>Copyright Notice: </strong>
    All articles in this blog are licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> unless stating additionally.
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/vb/" rel="tag"><i class="fa fa-tag"></i> vb</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2011/04/06/110406-game-vbmodule/" rel="next" title="vb修改游戏常用模块">
                <i class="fa fa-chevron-left"></i> vb修改游戏常用模块
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2011/05/04/110504-browser-vb/" rel="prev" title="browser-vb">
                browser-vb <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
      <script data-ad-client="ca-pub-3578624407535320" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="tosobright">
            
              <p class="site-author-name" itemprop="name">tosobright</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">51</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">4</span>
                  <span class="site-state-item-name">categories</span>
                
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">tags</span>
                
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/tosobright" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://gitee.com/tosobright" target="_blank" title="Gitee">
                      
                        <i class="fa fa-fw fa-git"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:tosobright@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:toso@soshare.cn" target="_blank" title="E-Mail2">
                      
                        <i class="fa fa-fw fa-envelope-square"></i></a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.soshare.cn/" title="Soshare" target="_blank">Soshare</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#使用-API-介绍"><span class="nav-number">1.</span> <span class="nav-text">使用 API 介绍</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#代码-demo"><span class="nav-number">2.</span> <span class="nav-text">代码 demo</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2010 &mdash; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">tosobright</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







  <div style>
    <script src="//s95.cnzz.com/z_stat.php?id=1726916&web_id=1726916" language="JavaScript"></script>
  </div>



        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: true,
        appId: 'TMSskYT1d5742mMn1W68iohd-gzGzoHsz',
        appKey: 'dIOnzLoKHUh71UF48oH6r0Qe',
        placeholder: 'Just go go',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("TMSskYT1d5742mMn1W68iohd-gzGzoHsz", "dIOnzLoKHUh71UF48oH6r0Qe");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  

  
  


  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=5.1.4"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=5.1.4"></script>


  

</body>
</html>
